using System;
using System.Collections.Generic;
using System.Text;

namespace uk.co.tonyditchfield.tort.attributes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class DBFieldAttribute : Attribute
    {
        /// <summary>
        /// Allows the engine to determine the fact the attached objects field is actually for persistence
        /// </summary>
        public DBFieldAttribute() { }

        /// <summary>
        /// Allows the engine to determine the fact the attached objects field is actually for persistence
        /// Additionally the column name can be aliased here since the DB schema may not match exactly.
        /// </summary>
        /// <param name="columnName"></param>
        public DBFieldAttribute(string columnName)
        {
            ColumnName = columnName;
        }

        private string columnName;

        /// <summary>
        /// Column name to match to FieldName.
        /// </summary>
        public string ColumnName
        {
            get { return columnName; }
            set { columnName = value; }
        }
    }
}
